package org.marsdonne.audits;

import com.fasterxml.jackson.databind.JsonNode;

public interface AuthAuditable {
    void identified(Identified identified);

    default void identified(String user, Identified.Action action, JsonNode additions) {
        this.identified(new Identified(user, action, additions));
    }

    /**
     * 发掘用户
     * @param user
     * @param additions, 发掘的条件/渠道/形式等等
     */
    default void found(String user, JsonNode additions) {
        this.identified(user, Identified.Action.Found, additions);
    }

    /**
     * (个人)用户签约
     * @param user
     * @param additions
     */
    default void signedOn(String user, JsonNode additions) {
        this.identified(user, Identified.Action.SignOn, additions);
    }

    /**
     * 身份认证
     * @param user
     * @param additions
     */
    default void authenticated(String user, JsonNode additions) {
        this.identified(user, Identified.Action.Authenticate, additions);
    }

    /**
     * 用户授权
     * @param user
     * @param additions
     */
    default void authorized(String user, JsonNode additions) {
        this.identified(user, Identified.Action.Authorize, additions);
    }

    /**
     * 用户注销
     * @param user
     * @param additions
     */
    default void cancel(String user, JsonNode additions) {
        this.identified(user, Identified.Action.Cancel, additions);
    }
}
